package com.fwx.basic.inner_class;

/**
 * @author : fengwenxiang
 * @date : 2022/5/14 15:54
 * @description：匿名内部类(顾名思义没有类名，自然没有构造方法)
 */
public class OutClass_AnonymousInner {
    public static AnonymousInterface getInstance(final String str){
        return new AnonymousInterface() {
            final static int a = 1;//
            public void doSomething() {
                System.out.println("say : "+str);//需要final修饰
            }
        };
    }
}
/**不加final修饰时 : Variable ‘xxx’ is accessed from within inner class, needs to be final or effectively final
   变量’xxx’从内部类中访问，需要final或有效的final**/
